package com.itboy.service;

import com.itboy.bean.User;
import com.itboy.mapper.UserMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

@Service
public class UserService {
    @Autowired
   private UserMapper userMapper;

    public User queryById(Integer id){
        //根据id查询(mybatis)
        return userMapper.selectByPrimaryKey(id);
    }
    @Transactional
    public void saveUser(User user){

        userMapper.insertSelective(user);
        System.out.println("新增用户...");
    }


}

